import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import axios from 'axios';

@Injectable()
export class PusherService {
  private readonly appToken: string;

  constructor(private readonly config: ConfigService) {
    this.appToken = this.config.get('pusher.appToken');
  }

  async sendMessage(data: any) {
    return axios.post('https://wxpusher.zjiecode.com/api/send/message', {
      appToken: this.appToken,
      verifyPayType: 0,
      ...data,
    });
  }
}
